In a transformer, why are both coils apart from each other? Wouldn’t make more sense to have the ferrite core (tube shape), wind the primary coil around that and then wind the secondary coil on top of the primary? So that the magnetic fields are as close to each other as possible?
That does actually exist, it’s called a toroidal transformer. Instead of a tube shape though it’s a donut shaped piece of ferrite with the primary and secondary wound one on top of the other. The different types have different use cases though, as far as I remember the toroidal ones have higher leakage current. Marco Reps has a good video on his YouTube channel where he explains some of the differences if you’re interested, although he mainly focuses on what’s important for precision electronics.