Is it RAW?
It is weird I never noticed this before, but it looks like this is RAW. As long as your total time casting spells or doing any other non-restful activity doesn't exceed 1 hour, it can be part of the rest.
Is it RAI?
As per one developers opinion here: Does a short combat or casting one spell interrupt a Long Rest? (credit to enkryptor's answer above), it appears it is allowed, RAI. The intent is that you need enough of an interruption that you give up on getting proper rest (at least 1 hour's worth). Basic spellcasting of simple one/round spells or even a combat encounter is not enough to stop the rest if you get right back to it
Is it fair/balanced?
I think it is. Most of the time, spells have pretty low durations and usually long rests are taken places far from combat, so many buffs would fall off before you use them anyway. Longer duration ones are the ones you would get benefit out of, but I think they are few enough of them that it should be fine, especially since most long duration buffs are concentration anyway.
How does this compare with previous editions?
In previous editions, there were specific things each casting class had to do to get their spells back each day. They didn't even necessarily need to sleep anywhere near the time they do this. For example, a cleric needs to pray to their god for 10 minutes I think it is in 3.5/pathfinder once/day to get their spells back. Depending on your god, this might be done in the evening, the morning, or even noon. As such, if you typically sleep at night and pray to get spells back in the morning, you could cast the previous days spells before praying for the new ones. This was pretty much expected, especially since in 3.5/pathfinder, you don't full heal just by resting, so casting healing spells before getting your spells back was expected.
Conclusion
This looks to be legitimate. If it works for your table, keep doing it. Of course the GM always has the final say.